<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>个人资料</title>
    <link rel="stylesheet" th:href="@{/layui/layui.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/css/index.css}"/>


</head>
<body>
<div th:switch="${session.user.getRole()}">
    <input th:unless="${session.user eq null}" id="role" th:value="${session.user.getRole()}" hidden="hidden" />

<!--管理员的个人信息-->
<div class="main laoshi" th:case="1">
    <div class="m_all20">
        <blockquote class="clear layui-elem-quote">个人资料</blockquote>
        <form action="" class="layui-form" method="post">
            <center>
                <table class="tables w_50 f15 hl45 ll">
                    <tbody>
                    <tr>
                        <th>个人资料</th>
                    </tr>
                    <tr>
                        <td class="pl50">编号：　
                            <div class="layui-inline w_50"><input type="text" id="tteaId" name="tea_id" class="layui-input" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">姓名：　
                            <div class="layui-inline w_50"><input type="text" id="tname" name="names" class="layui-input" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">性别：　
                            <div class="layui-inline w_50"><input type="text" id="tsex" name="sex" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">手机：　
                            <div class="layui-inline w_50"><input type="text" id="tphone" name="tel" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">邮箱：　
                            <div class="layui-inline w_50"><input type="text" id="tremail" name="email" class="layui-input"
                                                                  value=""/></div>
                        </td>
                    </tr>
                   <!-- <tr>
                        <td class="pl50">身份证：
                            <div class="layui-inline w_50"><input type="text" id="tcard" name="card" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>-->
                   <!-- <tr>
                        <td class="pl50">职位：　
                            <div class="layui-inline w_50"><input type="text" id="tjob" name="pid" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">电话：　
                            <div class="layui-inline w_50"><input type="text" id="ttel" name="sid" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">邮箱：　
                            <div class="layui-inline w_50"><input type="text" id="tremail" name="email" class="layui-input"
                                                                  value=""/></div>
                        </td>
                    </tr>-->
                    <!--<tr>
                        <td align="center" class="p_all10">
                            <button type="submit" class="layui-btn layui-btn-big layui-btn-normal white"
                                    name="into_class" onclick="return check(this.form)">保存
                            </button>
                            　　
                            <button type="reset" class="layui-btn layui-btn-big layui-btn-warm white" name="reset"
                                    id="backid">清空
                            </button>
                        </td>
                    </tr>-->
                    </tbody>
                </table>
            </center>
        </form>
    </div>
</div>

   <!-- 学生个人信息-->
    <div class="xuesheng" th:case="0">
        <blockquote class="clear layui-elem-quote">个人资料</blockquote>
        <form action="" class="layui-form" method="post">
            <center>
                <table class="tables w_50 f15 hl45 ll">
                    <tbody>
                    <tr>
                        <th>个人资料</th>
                    </tr>
                    <tr>
                        <td class="pl50">学号：　
                            <div class="layui-inline w_70"><input type="text" id="sid" name="names" class="layui-input" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">姓名：　
                            <div class="layui-inline w_70"><input type="text" id="sname" name="names" class="layui-input" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">性别：　
                            <div class="layui-inline w_70"><input type="text" id="ssex" name="sex" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">寝室号：　
                            <div class="layui-inline w_60"><input type="text" id="sroom" name="sex" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">手机：　
                            <div class="layui-inline w_70"><input type="text" id="sphone" name="tel" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">班级：　
                            <div class="layui-inline w_70"><input type="text" id="scla" name="tel" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">学院：　
                            <div class="layui-inline w_70"><input type="text" id="sacad" name="pid" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">生源地：　
                            <div class="layui-inline w_60"><input type="text" id="spro" name="pid" class="layui-input" value=""/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">入学时间：　
                            <div class="layui-inline w_50"><input type="text" id="stime" name="email" class="layui-input"/></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="pl50">出生日期：　
                            <div class="layui-inline w_50"><input type="date" id="sbir" name="email" class="layui-input" value=""/></div>
                        </td>
                    </tr>
                <!--    <tr>
                        <td align="center" class="p_all10">
                            <button type="submit" class="layui-btn layui-btn-big layui-btn-normal white"
                                    name="into_class" onclick="return check(this.form)">保存
                            </button>
                            　　
                            <button type="reset" class="layui-btn layui-btn-big layui-btn-warm white" name="reset"
                                    id="">清空
                            </button>
                        </td>
                    </tr>-->
                    </tbody>
                </table>
            </center>
        </form>

    </div>

</div>
<script type="text/javascript" th:src="@{/js/jquery-3.2.1.js}"></script>
<script th:src="@{/layui/layui.all.js}"></script>
<script th:ononline="javascript">

    var role = $('#role').val();
    console.log(role);

    if( role == 1) {
    $.get("tea/sess", function (obj) {
        // var date =obj.date;
      /*  console.log(obj);*/
        //console.log(obj.date);
        $('#tteaId').val(obj.tea_id);
        $('#tname').val(obj.name);
        $('#tsex').val(obj.sex);
        $('#tcard').val(obj.idcard);
        $('#tjob').val(obj.job);
        $('#tphone').val(obj.phone);
        $('#tremail').val(obj.email);
        $('#ttel').val(obj.tel);


    })

    }else if (role == 0){
    $.get("stu/sess", function (res) {
        console.log(res);
        $('#sid').val(res.stu_id);
        $('#sname').val(res.name);
        $('#ssex').val(res.sex);
        $('#scla').val(res.cla);
        $('#sacad').val(res.acad);
        $('#spro').val(res.pro);
        $('#stime').val(res.time);
        $('#sbir').val(res.birthday);
        $('#sphone').val(res.phone);
        $('#sroom').val(res.r_id);


    })
}





</script>

</body>
</html>